import * as services from './services/services';

export default {
  namespace: 'codeGenerate',
  state: {},
  effects: {

    /**
     * 查询全部模板
     * @param payload
     * @param callback
     * @param call
     * @returns {Generator<*, void, *>}
     */* allTemplates ({ payload, callback }, { call }) {
      const result = yield call(services.allTemplates, payload);
      if (callback && typeof callback === 'function') {
        callback(result);
      }
    },

    /**
     * 导入文件
     * @param payload
     * @param callback
     * @param call
     * @returns {Generator<*, void, *>}
     */* importFile ({ payload, callback }, { call }) {
      const result = yield call(services.importFile, payload);
      if (callback && typeof callback === 'function') {
        callback(result);
      }
    },

    /**
     * 代码生成
     * @param payload
     * @param callback
     * @param call
     * @returns {Generator<*, void, *>}
     */* generateCode ({ payload, callback }, { call }) {
      const result = yield call(services.generateCode, payload);
      if (callback && typeof callback === 'function') {
        callback(result);
      }
    },

  },

  reducers: {},

};
